package com.wodan.zhongjinjicang.common.exception;

/**
 * @ClassName: BusinessException
 * @Description: 用户业务处理异常
 * @author chenw
 * @date 2014-12-27 下午2:48:21
 * @history
 */
public class BusinessException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private final int errCode; // 错误编码

	private final String errMsg; // 错误信息
	
	/**
	 * 记录到log文件中的错误信息
	 */
	private final String logMsg; 

	private final boolean logExceptionStackTrance;

	public BusinessException(int errCode, String errMsg) {
		this(errCode, errMsg, errMsg, true);
	}
	
	public BusinessException(int errCode, String errMsg, boolean logExceptionStackTrance) {
		this(errCode, errMsg, errMsg, logExceptionStackTrance);
	}

	public BusinessException(int errCode, String errMsg, String logMsg, boolean logExceptionStackTrance) {
		super("code=" + errCode + ", msg=" + logMsg);
		this.errCode = errCode;
		this.errMsg = errMsg;
		this.logMsg = logMsg;
		this.logExceptionStackTrance = logExceptionStackTrance;
	}

	public int getErrCode() {
		return errCode;
	}

	public String getErrMsg() {
		return errMsg;
	}
	
	public boolean isLogExceptionStackTrance() {
		return logExceptionStackTrance;
	}
	
	public String getLogMsg() {
		return logMsg;
	}
}
